<script setup lang='ts'>

//动态获取页面参数
import { onMounted, ref } from 'vue'
import { getCheckOrderDetailsByItemIdAPI } from '@/services/docter/checkOrder'
import { onLoad } from '@dcloudio/uni-app'

const query = defineProps<{
  itemId?: string
}>()

const checkOrderDetails = ref()
const getCheckOrderDetailsByItemId = async () => {
  const res = await getCheckOrderDetailsByItemIdAPI(query.itemId)
  checkOrderDetails.value = res.data
}

onMounted(() => {
  getCheckOrderDetailsByItemId()
})
</script>

<template>
  <uni-card :title='`处方ID：${checkOrderDetails?.careOrderItem?.itemId }`'>
    <view class='contentItem'>
      <view>检查项目：{{ checkOrderDetails?.careOrderItem?.itemName }}</view>
      <view>备注信息：{{ checkOrderDetails?.careOrderItem?.remark }}</view>
      <view>项目价格：{{ checkOrderDetails?.careOrderItem?.price }}</view>
      <view>检查次数：{{ checkOrderDetails?.careOrderItem?.num }}</view>
    </view>
  </uni-card>
  <uni-card v-if='checkOrderDetails?.checkResult'>
    <uni-title type='h1' title='检测结果'></uni-title>
    <view style='font-weight: bold'>医生建议：{{ checkOrderDetails?.checkResult?.resultMsg}}</view>
    <view v-for='(item,index) in checkOrderDetails?.checkResult?.resultImg' :key='item.url'>
      <image :src='item.url'></image>
      <uni-title type='h4' :title='index+1' align='center'></uni-title>
    </view>
  </uni-card>
</template>


<style scoped lang='scss'>
.top {
  padding: 20rpx;

  .contentItem {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;

    > view {
      width: 48%;
      padding: 5rpx 0;
      color: #999;
    }
  }

  view {
    .green {
      color: #00bf9c;
    }
  }
}

</style>
